package com.runssnail.huafeiduo.api.request.phone;

import com.runssnail.huafeiduo.api.request.GetRequest;
import com.runssnail.huafeiduo.api.response.phone.OrderPhoneCheckResponse;

import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

/**
 * 检查当前是否可以下单，以及下单价格。
 *
 * Created by zhengwei on 2016/3/31.
 */
public class OrderPhoneCheckRequest extends GetRequest<OrderPhoneCheckResponse> {

    private static final long serialVersionUID = 4495491313068773210L;

    /**
     * 面值单位元
     */
    private int cardWorth;

    /**
     * 要充值的手机号码
     */
    private String mobile;

    @Override
    public String getApiUrl() {
        return "http://api.huafeiduo.com/gateway.cgi?mod=order.phone.check";
    }

    @Override
    public Map<String, Object> getParams() {
        SortedMap<String, Object> params = new TreeMap<>();

        params.put("card_worth", this.cardWorth);
        params.put("phone_number", this.mobile);

        return params;
    }

    @Override
    public Class<OrderPhoneCheckResponse> getResponseClass() {
        return OrderPhoneCheckResponse.class;
    }

    public int getCardWorth() {
        return cardWorth;
    }

    public void setCardWorth(int cardWorth) {
        this.cardWorth = cardWorth;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
}
